{#
This file is part of EC-CUBE

Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.

http://www.ec-cube.co.jp/

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#}
{% extends 'default_frame.twig' %}

{% set menus = ['setting', 'system', 'member'] %}

{% block title %}システム設定{% endblock %}
{% block sub_title %}メンバー管理{% endblock %}

{% form_theme form 'Form/bootstrap_3_horizontal_layout.html.twig' %}

{% block javascript %}
    <script>
        function changeAction(action) {
            document.form1.action = action;
        }
    </script>
{% endblock %}

{% block main %}
    <div class="row">
        <div id="member_wrap" class="col-md-12">
            <div id="member_list_box" class="box">
                <div id="member_list_box__header" class="box-header">
                    <h3 class="box-title">メンバー管理</h3>
                </div><!-- /.box-header -->
                <div id="member_list_box__body" class="box-body">
                    <form name="form1" id="form1" method="post" action="">
                        <div id="member_list__body" class="table_list">
                            <div id="member_list__body_inner" class="table-responsive with-border">
                                <table class="table table-striped">
                                    <thead>
                                    <tr id="member_list__list_header">
                                        <th id="member_list__header_name">名前</th>
                                        <th id="member_list__header_department">所属</th>
                                        <th id="member_list__header_authority_name">権限</th>
                                        <th id="member_list__header_work_name">稼働</th>
                                        <th id="member_list__header_menu_box">&nbsp;</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for Member in Members %}
                                    <tr id="member_list__item--{{ Member.id }}">
                                        <td id="member_list__name--{{ Member.id }}">{{ Member.name }}</td>
                                        <td id="member_list__department--{{ Member.id }}">{{ Member.department }}</td>
                                        <td id="member_list__authority_name--{{ Member.id }}">{{ Member.Authority.name }}</td>
                                        <td id="member_list__work_name--{{ Member.id }}">{{ Member.Work.name }}</td>
                                        <td id="member_list__menu_box--{{ Member.id }}" class="icon_edit">
                                            <div id="member_list__menu_box_toggle--{{ Member.id }}" class="dropdown">
                                                <a class="dropdown-toggle--{{ Member.id }}" data-toggle="dropdown" aria-expanded="false"><svg class="cb cb-ellipsis-h"> <use xlink:href="#cb-ellipsis-h" /></svg></a>
                                                <ul id="member_list__menu--{{ Member.id }}" class="dropdown-menu dropdown-menu-right">
                                                    <li><a href="{{ url('admin_setting_system_member_edit', { 'id' : Member.id }) }}" >編集</a></li>
                                                    {% if Member.id == app.user.id %}
                                                        <li>
                                                            <a>削除</a>
                                                        </li>
                                                    {% else %}
                                                        <li>
                                                            <a href="{{ url('admin_setting_system_member_delete', {id: Member.id}) }}" {{ csrf_token_for_anchor() }} data-method="delete">削除</a>
                                                        </li>
                                                    {% endif %}
                                                    {% if loop.first == false %}
                                                        <li>
                                                            <a href="{{ url('admin_setting_system_member_up', {id: Member.id}) }}"  {{ csrf_token_for_anchor() }} data-method="put" data-confirm="false">上へ</a>
                                                        </li>
                                                    {% endif %}
                                                    {% if loop.last == false %}
                                                        <li>
                                                            <a href="{{ url('admin_setting_system_member_down', {id: Member.id}) }}"  {{ csrf_token_for_anchor() }} data-method="put" data-confirm="false">下へ</a>
                                                        </li>
                                                    {% endif %}

                                                </ul>
                                            </div>
                                        </td>
                                    </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
            </div><!-- /.box -->
            <div id="member_list__footer" class="row">
                <div id="member_list__insert_button" class="col-xs-10 col-xs-offset-1 col-sm-6 col-sm-offset-3 text-center btn_area">
                    <a href="{{ url('admin_setting_system_member_new') }}" class="btn btn-primary btn-block btn-lg">
                            新規登録
                    </a>
                </div>
            </div>

        </div>
    </div>

{% endblock %}